package service

import (
	"context"
	"gitee.com/fowa/fowa-server/api/task"
	"gitee.com/fowa/fowa-server/internal/biz"
)

type TaskProvider struct {
	tb *biz.TaskBiz
	task.UnimplementedTaskServiceServer
}

func NewTaskProvider(tb *biz.TaskBiz) *TaskProvider {
	return &TaskProvider{
		tb: tb,
	}
}

func (s *TaskProvider) Create(ctx context.Context, in *task.Task) (*task.Task, error) {
	s.tb.Create(&biz.Task{
		TaskName:  in.TaskName,
		Image:     in.Image,
		Env:       in.Env,
		StartTime: in.StartTime,
		EndTime:   in.EndTine,
		Status:    in.Status,
	})
	return &task.Task{TaskName: in.TaskName}, nil
}

//func ()
